

const path = require('path');
const staticImg = path.join(__dirname, 'static');

function SensorbitUnoBlocks(Blockly) {
    var show_color = "#f59057";



     //LED
     Blockly.Blocks.microbit_led = {
        init:function(){
        this.setColour(show_color);
        this.appendDummyInput("")
        .appendField(new Blockly.FieldImage(staticImg+"/4.LED-Module.svg", 84, 42))
            .appendField(Blockly.Msg.MICROBIT_LED)
            .appendField(new Blockly.FieldDropdown([
                ['P0', "pin0"],
                ['P1', "pin1"],
                ['P2', "pin2"],
                ['P8', "pin8"],
                ['P12', "pin12"],
                ['P13', "pin13"],
                ['P14', "pin14"],
                ['P15', "pin15"],
            ]),"ledPort")
            this.appendDummyInput("")
            .appendField(Blockly.Msg.MICROBIT_STATUS)
            .appendField(new Blockly.FieldDropdown([
            [Blockly.Msg.MICROBIT_OPEN, "True"],
            [Blockly.Msg.MICROBIT_CLOSE, "False"],
            ]),"ledStatus")
            this.setPreviousStatement(true, null);
           this.setNextStatement(true, null);
           this.setTooltip('');
        }
    };

    return Blockly;
}

module.exports = SensorbitUnoBlocks;

